<?php

declare(strict_types=1);

namespace App\Request;


use Hyperf\Validation\Request\FormRequest;

class LoginRequest extends BaseRequest
{

    /**
     * 定义需要验证的字段
     */
    public function getRulesByReg():array
    {
        return [
            'name' => ['bail','required','max:20'],
            'password' =>['bail','required','min:6','max:16'],
        ];
    }

    /**
     * 获取已定义验证规则的错误消息
     */
    public function messages(): array
    {
        return [
            'name.required' => '名称必传',
            'name.max' => '名称不能超过20个字符',

            'password.required' => '密码必传',
            'password.min'  => '密码最少6个字符',
            'password.max'  => '密码不能超过16个字符',
        ];
    }

}
